package com.designmodel.struct.jdkdynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class ProxyTest1 {

    public static void main(String[] args) {
        Iuser user = new UserImpl();
        InvocationHandler h = new DynamicProxy1(user);
        Iuser proxy =
                (Iuser) Proxy.newProxyInstance(Iuser.class.getClassLoader(), new Class[]{Iuser.class}, h);
        proxy.eat("苹果");
    }
}
